Skip to content

Conversation

@sfiligoi
Copy link

@sfiligoi sfiligoi commented May 7, 2025

OpenMP now allows to offload the compute to accelerators, typically GPUs.
This PR adds the necessary pragmas to make this an option.
The GPU offload is enabled with the OMPGPU macro. The compiler must of course support it, too.
Furthermore, if both OMPGPU and OMPGPU_UNIFIED macros are specified, the explicit GPU memory movement is disabled, and the OpenMP unified memory semantics is used instead.

Note that the PR also includes the switch from the static arrays to dynamically allocated memory.
This was needed for two reasons:

  1. unified memory is only guaranteed to work with dynamic memory allocation
  2. many compilers limit the size of the static buffers, thus making it impossible to increase the size to accommodate for the needs of modern GPUs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant